package ru.space_game.gui;

import java.util.HashMap;
import java.util.Map;

public class Announcer {

	private Map<String, SimpleMessage> messages;

	public void addMessage(String key, SimpleMessage message) {
		if (messages == null)
			messages = new HashMap<String, SimpleMessage>();
		messages.put(key, message);
	}

	public SimpleMessage getMessage(String key) {
		return messages.get(key);
	}

	public void draw() {
		for (String key : messages.keySet()) {
			SimpleMessage message = messages.get(key);
			if (message.isVisible())
				message.draw();

		}
	}

	public void hideAllMessages() {
		for (String key : messages.keySet()) {
			messages.get(key).setVisible(false);

		}
	}

	public void showMessage(String message) {
		getMessage(message).setVisible(true);
	}

	public void hideMessage(String message) {
		getMessage(message).setVisible(false);
	}

}
